package com.bjt.wms.sys.controller;

import com.bjt.common.config.paragetter.BasePageRequest;
import com.bjt.wms.sys.model.base.LogLogin;
import com.bjt.wms.sys.service.LogService;
import com.jfinal.aop.Inject;
import com.jfinal.core.Controller;
import com.jfinal.kit.Kv;
import com.jfinal.kit.StrKit;

/**
 * @author WenbinJi
 * 操作日志管理
 */
public class LogController extends Controller {

    @Inject
    private LogService logService;

    public void queryLogLoginList(BasePageRequest<LogLogin> basePageRequest) {

        Kv cond = Kv.create();

        if (StrKit.notBlank(getPara("dateRange"))) {
            cond.set("date_start", getPara("dateRange").split(" - ")[0]);
            cond.set("date_end", getPara("dateRange").split(" - ")[1]);
        }
        renderJson(logService.queryLogLoginList(basePageRequest, cond));
    }

    public void queryLogOperateList(BasePageRequest<LogLogin> basePageRequest) {

        Kv cond = Kv.create();

        if (StrKit.notBlank(getPara("dateRange"))) {
            cond.set("date_start", getPara("dateRange").split(" - ")[0]);
            cond.set("date_end", getPara("dateRange").split(" - ")[1]);
        }
        renderJson(logService.queryLogOperateList(basePageRequest, cond));
    }

    public void queryLogSysList(BasePageRequest<LogLogin> basePageRequest) {

        Kv cond = Kv.create();

        if (StrKit.notBlank(getPara("dateRange"))) {
            cond.set("date_start", getPara("dateRange").split(" - ")[0]);
            cond.set("date_end", getPara("dateRange").split(" - ")[1]);
        }
        renderJson(logService.queryLogSysList(basePageRequest, cond));
    }
}
